<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="app">
    <button @click="greet">
        Greet
    </button>
</div>

<script>
    const {createApp, ref} = Vue
    const name = ref('Vue.js')

    function greet(event) {
        alert(`Hello ${name.value}!`)
        // `event` 是 DOM 原生事件
        if (event) {
            alert(event.target.tagName)
        }
    }

    createApp({
        setup() {
            return {
                name,
                greet
            }
        }
    }).mount('#app')
</script>
</body>
</html>